<template>
		<view class="detail p-30">
			<view class="detail-body">
				<view class="title">
					{{info.title}}
				</view>
				<view class="metas mt-20">
					<view><u-icon :customStyle="{marginRight:'5px'}" name="account"></u-icon>{{info.author}}</view>
					<view><u-icon :customStyle="{marginRight:'5px'}" name="clock" ></u-icon>{{info.publishTime}}</view>
					<view><u-icon :customStyle="{marginRight:'5px'}" name="eye" ></u-icon>{{info.viewCount}}</view>
				</view>
				<view class="summary mt-30" v-if="info.summary">
					<view class="summary-icon">
						<u-icon name="file-text" color="#555"></u-icon>
					</view>
					<view class="summary-con">
						{{info.summary}}
					</view>
					
				</view>
			<!-- 	<view class="cover mt-30">
					<u-image width="100%" mode="widthFix" :src="info.coverImageUrl"></u-image>
				</view> -->
				<view class="content mt-30">
					<u-parse :content="info.content"></u-parse>
				</view>
			</view>
			<view class="detail-foot">
				<view class="tags">
					<text v-for="v in info.tags"># {{v}}</text>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {
		getNewsDetail
	} from '@/config/api.js'

	export default {
		data() {
			return {
				options: {},
				info: {}
			};
		},
		onLoad(options) {
			this.options = options;
			this.getPageData();
		},
		methods: {
			async getPageData() {
				let res = await getNewsDetail(this.options.id);
				this.info = res;
			}
		}
	};
</script>

<style lang="scss">
	page {}
	.detail{
		.detail-body{
			padding:30rpx 0;
		}
		.detail-foot{
			padding:20rpx 0;
			border-top:1rpx solid #eee;
		}
	}

	.title {
		font-size: 17px;
		font-weight: bold;
	}
	.summary{
		display: flex;
		background-color: #f7f7f7;
		border-radius: 10rpx;
		padding:20rpx;
		.summary-icon{
			flex-shrink: 0;
			margin-top:2px;
		}
		.summary-con{
			flex-grow:1;
			padding-left:6px;
			font-size:14px;
			color:#555;
		}
	}
	.metas {
		display: flex;
		align-items: center;
		margin-left: -10rpx;
		margin-right: -10rpx;

		&>text,
		&>view {
			font-size: 24rpx;
			margin: 0 10rpx;
			color: #999999;
		}
		&>view {
			display: flex;
			align-items: center;
		}
	}
	.tags{
		margin:-10rpx;
		text{
			display: inline-block;
			padding:2px 8px;
			border-radius: 5px;
			background-color: #f7f7f7;
			font-size:12px;
			margin:10rpx;
			color: #888888;
		}
	}
</style>